/*******************************************************************************
 * Copyright 2007, 2009 InnovaSoft SA http://www.innovasoft.biz/
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
 
package biz.innovasoft.nodb.query;

import java.io.Serializable;
import java.util.List;

import biz.innovasoft.nodb.UpdateableList;

/**
 * This class is returned by the QueryCriteria.find() methods. Contains the
 * tuples returned by the query and extra information.
 * 
 * @author Diego Miranda
 *
 */
public interface Result extends Serializable {

	/**
	 * Returns the result as a List that can be updated.
	 * 
	 */
	public <R>UpdateableList<R> asUpdateableList();
	
	/**
	 * Returns the result as a List of tuples.
	 */
	public List<Tuple> asListOfTuples();
	
	/**
	 * Returns true if the last query used a temporal index.
	 */
	public boolean getUseTemporalIndex ();
	
	/**
	 * Returns the cache id identifying the query.
	 */
	public String getIndexCacheId();

	/**
	 * Returns the amount of hits in the index for the executed query.
	 */
	public int getTotalHits();

	/**
	 * Returns the number of page retrieved.
	 * @return
	 */
	public int getPage();

	/**
	 * Returns the amount of objects this result contains.
	 */
	public int getMaxResults();

	public int getMinRange();
	public int getMaxRange();

	/**
	 * Returns the amount of pages for the executed query.
	 */
	public int getMaxPages ();
	
	/**
	 * Returns the size of the result.
	 */
	public int size ();
	
}
